package com.thwcompany.service;
import cn.hutool.core.date.DateUtil;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by IntelliJ IDEA2021.3
 * @Author: Tenghw
 * @Date: 2022/10/21  20:44
 * @Description:
 */

@Service
public class BusinessSendService {
    @Autowired
    RabbitTemplate rabbitTemplate;

    public void send(String routingKey, String message) {
        rabbitTemplate.convertAndSend("business.exchange", routingKey, message);
        String format = DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss.SSS");
        System.out.println(format+" >>> 生产者发送的业务消息：" + message);
    }
}

